package com.charity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.charity.domain.CharityBox;
import org.apache.ibatis.annotations.*;

@Mapper
public interface CharityBoxMapper extends BaseMapper<CharityBox> {
    /**
     * 根据状态查询公益柜
     */
    @Select("SELECT * FROM charity_box WHERE status = #{status}")
    Page<CharityBox> selectByStatus(@Param("status") Integer status, @Param("page") Page<CharityBox> page);

    /**
     * 查询公益柜是否存在
     */
    @Select("SELECT COUNT(*) > 0 FROM charity_box WHERE id = #{id}")
    boolean existsById(@Param("id") Long id);

    /**
     * 查询所有公益柜
     */
    @Select("SELECT * FROM charity_box")
    Page<CharityBox> selectAll(@Param("page") Page<CharityBox> page);
}